use std::collections::HashMap;
use std::fs;


pub fn converter(input: &str) -> String {
    let map = serde_json::from_str::<HashMap<String, String>>(&fs::read_to_string("../../pinyin.json").unwrap()).unwrap();
    let mut result = Vec::new();
    for c in input.chars() {
        if let Some(p) = map.get(&c.to_string()) {
            result.push(p.as_str());
        }
    }
    // 首字母大写，空格拼接
    let res = result.join(" ");
    if res.len() > 0 {
        res[0..1].to_uppercase() + &res[1..]
    } else {
        String::new()
    }
}
